#!/usr/bin/env bash
###################################################################################################
# USAGE:
#   Param1: Yocto Dir name, None = current dir
###################################################################################################
PROP_DIR=/home/share/proprietary
WORK_DIR=${HOME}/${1}

[ -z "$1" ] && WORK_DIR=`pwd`
[ -d ${WORK_DIR} ] || mkdir -p ${WORK_DIR}
[ -e ${WORK_DIR}/.init ] || cp /usr/local/bin/init-yocto ${WORK_DIR}/.init

docker run --rm -it \
    -v ~:/home/hosthome:ro \
    -v ${PROP_DIR}:/prop:ro \
    -v ${WORK_DIR}:/workdir \
    --name poky-`id -un`-`basename ${WORK_DIR}` \
    --workdir=/workdir \
    neu/poky/gcc8:ubuntu-18.04
